﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace devtm
{

    [Serializable]
    public class ListException : Exception , IList<Exception>
    {

        public List<Exception> list = new List<Exception>();
        public ListException() { }
        public ListException(string message) : base(message) { }
        public ListException(string message, Exception inner) : base(message, inner) { }
        protected ListException(
          System.Runtime.Serialization.SerializationInfo info,
          System.Runtime.Serialization.StreamingContext context)
            : base(info, context) { }


        public int IndexOf(Exception item)
        {
            return list.IndexOf(item);
        }

        public void Insert(int index, Exception item)
        {
            list.Insert(index, item);
        }

        public void RemoveAt(int index)
        {
            list.RemoveAt(index);
        }

        public Exception this[int index]
        {
            get
            {
                return list[index];
            }
            set
            {
                list[index] = value;
            }
        }
        

        public void Add(Exception item)
        {
            list.Add(item);
        }

        public void Clear()
        {
            list.Clear();
        }

        public bool Contains(Exception item)
        {
            return list.Contains(item);
        }

        public void CopyTo(Exception[] array, int arrayIndex)
        {
            list.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return list.Count; }
        }

        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(Exception item)
        {
            return list.Remove(item);
        }

        public IEnumerator<Exception> GetEnumerator()
        {
            return list.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return list.GetEnumerator();
        }
    }


}
